$OpenBSD: patch-src_actions_c,v 1.5 2013/09/19 20:43:54 sthen Exp $

1. Fix periodic focus bug
From: Pedro Gimeno <parigalo@formauri.es>
Date: Mon, 19 May 2008 17:52:00 -0300
http://repo.or.cz/w/wmaker-crm.git/commitdiff/c91bb1ba1360006c568db37438779e525868cf17

2. Bugfix: java menu problem after resize, maximize
From: Ambrus Szabo <donamo@donamo.hu>
Date: Tue, 5 Apr 2011 12:36:11 +0200
http://repo.or.cz/w/wmaker-crm.git/commit/7490b14bf0573283cd11eea3b1b6392c6f38e2dd

--- src/actions.c.orig	Sun Jul  3 18:25:14 2005
+++ src/actions.c	Thu Sep 19 21:43:05 2013
@@ -78,6 +78,15 @@ static struct {
 #define SHADE_STEPS	shadePars[(int)wPreferences.shade_speed].steps
 #define SHADE_DELAY	shadePars[(int)wPreferences.shade_speed].delay
 
+static int
+compareTimes(Time t1, Time t2)
+{
+	Time diff;
+	if (t1 == t2)
+		return 0;
+	diff = t1 - t2;
+	return (diff < 60000) ? 1 : -1;
+}
 
 /*
  *----------------------------------------------------------------------
@@ -99,11 +108,11 @@ wSetFocusTo(WScreen *scr, WWindow  *wwin)
 
     WWindow *old_focused;
     WWindow *focused=scr->focused_window;
-    int timestamp=LastTimestamp;
+    Time timestamp=LastTimestamp;
     WApplication *oapp=NULL, *napp=NULL;
     int wasfocused;
 
-    if (scr->flags.ignore_focus_events || LastFocusChange > timestamp)
+    if (scr->flags.ignore_focus_events || compareTimes(LastFocusChange, timestamp) > 0)
         return;
 
     if (!old_scr)
@@ -463,8 +472,8 @@ wMaximizeWindow(WWindow *wwin, int directions)
                     &new_width, &new_height);
 
     wWindowConfigure(wwin, new_x, new_y, new_width, new_height);
+    wWindowSynthConfigureNotify(wwin);
 
-
     WMPostNotificationName(WMNChangedState, wwin, "maximize");
 
     wSoundPlay(WSOUND_MAXIMIZE);
@@ -494,6 +503,7 @@ wUnmaximizeWindow(WWindow *wwin)
 
     wwin->flags.maximized = 0;
     wWindowConfigure(wwin, x, y, w, h);
+    wWindowSynthConfigureNotify(wwin);
 
     WMPostNotificationName(WMNChangedState, wwin, "maximize");
 
